load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")

oncall("scm_client_infra")

cpp_library(
    name = "local_store_test",
    headers = ["LocalStoreTest.h"],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        "//eden/common/testharness:temp_file",
        "//eden/common/utils:fault_injector",
        "//eden/fs/model:model",
        "//eden/fs/store:store",
        "//folly/io:iobuf",
    ],
)

cpp_unittest(
    name = "filtered_backing_store_test",
    srcs = [
        "FilteredBackingStoreTest.cpp",
    ],
    # TODO(T159481899): make HgRepo compile/run on Windows
    compatible_with = [
        "ovr_config//os:linux",
        "ovr_config//os:macos",
    ],
    supports_static_listing = False,
    deps = [
        "fbsource//third-party/googletest:gtest",
        "//eden/common/telemetry:structured_logger",
        "//eden/common/utils:case_sensitivity",
        "//eden/common/utils:fault_injector",
        "//eden/common/utils:path",
        "//eden/fs/config:config",
        "//eden/fs/model:testutil",
        "//eden/fs/store:filtered_backing_store",
        "//eden/fs/store:store",
        "//eden/fs/store/filter:hg_sparse_filter",
        "//eden/fs/store/hg:sapling_backing_store",
        "//eden/fs/store/hg:sapling_backing_store_options",
        "//eden/fs/testharness:fake_backing_store_and_tree_builder",
        "//eden/fs/testharness:fake_filter",
        "//eden/fs/testharness:hg_repo",
        "//eden/fs/testharness:test_util",
        "//folly:varint",
        "//folly/executors:manual_executor",
        "//folly/io:iobuf",
        "//folly/test:test_utils",
        "//folly/testing:test_util",
    ],
)

cpp_unittest(
    name = "test",
    srcs = [
        "BlobAccessTest.cpp",
        "BlobCacheTest.cpp",
        "DiffTest.cpp",
        "ImportPriorityTest.cpp",
        "LocalStoreTest.cpp",
        "ObjectCacheTest.cpp",
        "ObjectStoreTest.cpp",
        "RocksDbLocalStoreTest.cpp",
        "ScmStatusCacheTest.cpp",
        "TreeCacheTest.cpp",
        "TreeTest.cpp",
    ],
    supports_static_listing = False,
    deps = [
        "fbsource//third-party/googletest:gmock",
        "fbsource//third-party/googletest:gtest",
        "//eden/common/telemetry:structured_logger",
        "//eden/common/testharness:temp_file",
        "//eden/common/utils:fault_injector",
        "//eden/common/utils:immediate_future",
        "//eden/common/utils:path",
        "//eden/common/utils:process_info_cache",
        "//eden/fs/config:config",
        "//eden/fs/journal:journal",
        "//eden/fs/model:model",
        "//eden/fs/model:testutil",
        "//eden/fs/model/git:gitignore",
        "//eden/fs/service:thrift-cpp2-types",
        "//eden/fs/store:context",
        "//eden/fs/store:rocksdb",
        "//eden/fs/store:sqlite",
        "//eden/fs/store:store",
        "//eden/fs/telemetry:stats",
        "//eden/fs/testharness:fake_backing_store_and_tree_builder",
        "//eden/fs/testharness:logging_fetch_context",
        "//eden/fs/testharness:stored_object",
        "//eden/fs/testharness:test_util",
        "//eden/fs/utils:static_assert",
        "//folly/executors:manual_executor",
        "//folly/experimental/coro:gtest_helpers",
        "//folly/io:iobuf",
        "//folly/logging:logging",
        "//folly/test:test_utils",
    ],
)

cpp_binary(
    name = "object_cache_benchmark",
    srcs = ["ObjectCacheBench.cpp"],
    deps = [
        "//eden/common/utils/benchharness:benchharness",
        "//eden/fs/store:store",
    ],
)

cpp_binary(
    name = "rocksdb_benchmark",
    srcs = ["RocksDbLocalStoreBench.cpp"],
    deps = [
        "//eden/common/telemetry:structured_logger",
        "//eden/common/testharness:temp_file",
        "//eden/common/utils:fault_injector",
        "//eden/common/utils/benchharness:benchharness",
        "//eden/fs/config:config",
        "//eden/fs/model:model",
        "//eden/fs/store:rocksdb",
        "//eden/fs/telemetry:stats",
    ],
)
